Script Modules

Script Modules are independent entities that add new functionality to Packet Tracer similar to External Applications (ExApps). But unlike ExApps, Script Modules run within PT rather than as external processes, and therefore, provide better integration with PT. Also unlike ExApps, Script Modules are developed directly in PT with no external development environment needed. While the basic components of Script Modules are not new -- PT already has had a script engine, web views, and IPC in various internal components for some time, Script Modules simply unite them and provide a generic way to extend PT functionality.

Packet Tracer Architecture

Illustrated above is an architectural view of PT's run-time components showing that Script Modules are running inside the PT process. Script Modules communicate with the PT core the same way that ExApps communicate with PT, using Inter-Process Communication (IPC) calls. The IPC framework in PT has been extended to allow direct object manipulation, using objects in calls, event callbacks, and delegates. Script Modules and ExApps can also talk to each other using the PT messaging mechanism between ExApps.

Script Module Architecture

Each Script Module can be described using the Model-View-Controller architectural pattern.

- Model - PT engine and GUI accessed via IPC, Script Module data store, and save data in each pka/pkt file
- View - custom interfaces in web views, written in html, css, images, js
- Controller - scripts in script engine, written in ECMAScript (JavaScript)

Each Script Module has its own sandbox, and cannot access or change the sandbox of other Script Modules.

Types of Script Modules

There are two places where Script Modules can exist, and so they are named appropriately.

- PT Script Modules are encrypted .pts files. They are like ExApps, added to PT by the user (or auto-detected during PT launch), and they persist as long as PT is running. They can be started or stopped manually, started on PT launch, or on demand.
- The File Script Module is contained inside each pka/pkt file. When the pka/pkt file opens, the Script Module starts; when the file closes, the Script Module stops. The File Script Module is backwards compatible with activity files before 5.3.3 -- scripts in these pka files are loaded into the File Script Module.

The following table is a summary of differences between the two types of Script Modules:

| PT Script Module | File Script Module
--- | --- | ---
Location |

- Per PT install
- PT can have multiple PT Script Modules

One per pka/pkt file
Manage | Add/remove in Extensions->Scripting->Configure PT Script Modules... | Open the pka/pkt file, and go to Extensions->Scripting->Edit File Script Module...
Start |

- On PT start
- On demand
- Disabled

- On file open
- Cannot disable

Stop | On PT close | On file close
Manual start/stop | Yes | Yes
Security privileges |

- When the user adds a PT Script Module, it shows in the dialog
- If a user does not feel safe with the requested privileges, the Script Module can be removed

- When the file opens, PT prompts the user to allow the File Script Module to run
- If denied, the pka/pkt file may still open but not function correctly or may be prevented from opening. The File Script Module developer decides which action